using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace GameSite.Models.Mapping
{
    public class ActivityMap : EntityTypeConfiguration<Activity>
    {
        public ActivityMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.ID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.IsShow)
                .IsRequired();

            this.Property(t => t.Title)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.Content)
                .IsRequired();

            this.Property(t => t.CreateBy)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.ShortTitle)
                .HasMaxLength(16);

            this.Property(t => t.ImageTitle)
                .HasMaxLength(200);

            this.ToTable("Activity");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.IsShow).HasColumnName("IsShow");
            this.Property(t => t.Title).HasColumnName("Title");
            this.Property(t => t.ShortTitle).HasColumnName("ShortTitle");
            this.Property(t => t.Content).HasColumnName("Content");
            this.Property(t => t.CreateBy).HasColumnName("CreateBy");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.ImageTitle).HasColumnName("ImageTitle");
        }
    }
}
